/*
 * Copyright (C) 2013 Daniel Treffenstädt <daniel@treffenstaedt.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#ifndef OINPUT_H
#define OINPUT_H


#include "OGlobal.h"

#include "OWindow.h"
#include "Core/OObject.h"

#include "Core/OKeyEvent.h"
#include "Core/OMouseEvent.h"

#include <OIS/OISKeyboard.h>
#include <OIS/OISMouse.h>

O_START_NAMESPACE

class Input : public OIS::KeyListener, public OIS::MouseListener
{
private:
	OIS::InputManager*			m_inputManager;
	OIS::Mouse*					m_mouse;
	OIS::Keyboard*				m_keyboard;
	KeyEvent::Modifier			m_modifier;
	Window*						m_window;

	static KeyEvent::KeyCode toKey(OIS::KeyCode kc);
	static KeyEvent::Modifier toModifier(OIS::KeyCode kc);
	static MouseEvent::Button toButton(OIS::MouseButtonID mb);

public:
	Input(Window* win);
	void pollEvents();


	bool keyPressed( const OIS::KeyEvent& evt );
	bool keyReleased( const OIS::KeyEvent& evt );

	bool mouseMoved( const OIS::MouseEvent& evt );
	bool mousePressed( const OIS::MouseEvent& evt, OIS::MouseButtonID id );
	bool mouseReleased( const OIS::MouseEvent& evt, OIS::MouseButtonID id );
};

O_END_NAMESPACE

#endif // OINPUT_H
